package com.designpatternspart2.behavioraldesignpatterns.mediatorpattern;

/**
 *
 * @author Lance
 */
class AmericanSeller
{

    private Mediator mediator;
    private float priceInDollars;

    public AmericanSeller(Mediator mediator, float priceInDollars)
    {
        this.mediator = mediator;
        this.priceInDollars = priceInDollars;
        this.mediator.registerAmericanSeller(this);
    }

    public boolean isBidAccepted(float bidInDollars)
    {
        if (bidInDollars >= getPriceInDollars())
        {
            System.out.println("Seller accepts the bid of " + bidInDollars + " dollars\n");
            return true;
        }
        else
        {
            System.out.println("Seller rejects the bid of " + bidInDollars + " dollars\n");
            return false;
        }
    }

    public Mediator getMediator()
    {
        return mediator;
    }

    public void setMediator(Mediator mediator)
    {
        this.mediator = mediator;
    }

    public float getPriceInDollars()
    {
        return priceInDollars;
    }

    public void setPriceInDollars(float priceInDollars)
    {
        this.priceInDollars = priceInDollars;
    }
}
